exports.getCurrentDateTime = () => {
  // 创建一个新的Date对象，表示当前时间
  const now = new Date();

  // 获取年月日时分秒
  const year = now.getFullYear();
  const month = ("0" + (now.getMonth() + 1)).slice(-2); // 月份是从0开始的，所以需要+1，并且补足两位
  const day = ("0" + now.getDate()).slice(-2);
  const hours = ("0" + now.getHours()).slice(-2);
  const minutes = ("0" + now.getMinutes()).slice(-2);
  const seconds = ("0" + now.getSeconds()).slice(-2);

  // 组装成所需格式的字符串
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};

exports.getCurrentDateTimeObj = () => {
  // 创建一个新的Date对象，表示当前时间
  const now = new Date();

  // 获取年月日时分秒
  const year = now.getFullYear();
  const month = ("0" + (now.getMonth() + 1)).slice(-2); // 月份是从0开始的，所以需要+1，并且补足两位
  const day = ("0" + now.getDate()).slice(-2);
  const hours = ("0" + now.getHours()).slice(-2);
  const minutes = ("0" + now.getMinutes()).slice(-2);
  const seconds = ("0" + now.getSeconds()).slice(-2);

  // 组装成所需格式的字符串
  return {
    year,
    month,
    day,
    hours,
    minutes,
    seconds
  }
}
